# 排序算法
print(sorted([36, 5, -12, 9, -21]))  # 升序
print(sorted([36, 5, -12, 9, -21], key=abs))
print(sorted(['Bob', 'about', 'Zoo', 'Credit'], key=str.lower, reverse=True))

L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)]


def by_name(t):
    return t[0]


print(sorted(L, key=by_name))


def by_score(t):
    return t[1]


print(sorted(L, key=by_score))
